class HouseItem(object):
    def __init__(self, name, area):
        self.name = name
        self.area = area

bed = HouseItem("席梦思", 4)
chest = HouseItem("衣柜", 2)
table = HouseItem("餐桌", 1.5)

class House(object):
    def __init__(self, house_type, total_area):
        self.house_type = house_type
        self.total_area = total_area
        self.free_area = total_area
        self.name = []

    def add_itme(self, item):
        if item.area > self.free_area:
            print(f"{item.name}放不下了")
        else:
            self.name.append(item.name)
            self.free_area -= item.area

    def __str__(self):
        return f"户型：{self.house_type}， 总面积：{self.total_area}， 剩余面积：{self.free_area}， 家具：{self.name}"

house01 = House("一室一厅", 20)
house01.add_itme(bed)
house01.add_itme(chest)
house01.add_itme(table)
print(house01)


